package com.atstudy.headline.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;

/**
 * 推荐结果记录表
 * @TableName recommendations
 */
@TableName(value ="recommendations")
@Data
public class Recommendations {
    /**
     * 推荐ID
     */
    @TableId(type = IdType.AUTO)
    private Integer recoId;

    /**
     * 用户ID
     */
    private Integer userId;

    /**
     * 内容ID
     */
    private Integer contentId;

    /**
     * 推荐模型版本
     */
    private String modelVersion;

    /**
     * 推荐得分
     */
    private BigDecimal score;

    /**
     * 展示位置
     */
    private Integer position;

    /**
     * 曝光时间
     */
    private Date exposeTime;

    /**
     * 点击时间
     */
    private Date clickTime;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Recommendations other = (Recommendations) that;
        return (this.getRecoId() == null ? other.getRecoId() == null : this.getRecoId().equals(other.getRecoId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getContentId() == null ? other.getContentId() == null : this.getContentId().equals(other.getContentId()))
            && (this.getModelVersion() == null ? other.getModelVersion() == null : this.getModelVersion().equals(other.getModelVersion()))
            && (this.getScore() == null ? other.getScore() == null : this.getScore().equals(other.getScore()))
            && (this.getPosition() == null ? other.getPosition() == null : this.getPosition().equals(other.getPosition()))
            && (this.getExposeTime() == null ? other.getExposeTime() == null : this.getExposeTime().equals(other.getExposeTime()))
            && (this.getClickTime() == null ? other.getClickTime() == null : this.getClickTime().equals(other.getClickTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getRecoId() == null) ? 0 : getRecoId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getContentId() == null) ? 0 : getContentId().hashCode());
        result = prime * result + ((getModelVersion() == null) ? 0 : getModelVersion().hashCode());
        result = prime * result + ((getScore() == null) ? 0 : getScore().hashCode());
        result = prime * result + ((getPosition() == null) ? 0 : getPosition().hashCode());
        result = prime * result + ((getExposeTime() == null) ? 0 : getExposeTime().hashCode());
        result = prime * result + ((getClickTime() == null) ? 0 : getClickTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", recoId=").append(recoId);
        sb.append(", userId=").append(userId);
        sb.append(", contentId=").append(contentId);
        sb.append(", modelVersion=").append(modelVersion);
        sb.append(", score=").append(score);
        sb.append(", position=").append(position);
        sb.append(", exposeTime=").append(exposeTime);
        sb.append(", clickTime=").append(clickTime);
        sb.append("]");
        return sb.toString();
    }
}